<template>
  <div class="sdy-order-info">
    {{ info }}

    <br>
    <van-button @click="confirmOrderHandler" type="danger">
      确认订单信息
    </van-button>
  </div>
</template>

<script setup lang="ts">
import { defineProps, defineEmits } from 'vue'
import { confirmOrderApi } from '@/api/order'
import { Toast } from 'vant'

const { info } = defineProps<{info: any}>()
console.log(info)

const emits = defineEmits(['finish'])

const confirmOrderHandler = async () => {
  const res = await confirmOrderApi(info.userid, info.time)
  if (((res as unknown) as { code: string }).code === '200') {
    Toast({ message: '确认订单成功' })
    emits('finish')
  }
}

</script>

<style scoped lang="scss"></style>
